#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>

@class GeofenceInfo;

typedef NS_ENUM(NSInteger, XDXGeofenceSignal) {
    XDXGeofenceSignalGPS    = 1,
    XDXGeofenceSignalVisit  = 2,
    XDXGeofenceSignalRegion = 3
};

typedef void(^XDXFenceEventHandler)(GeofenceInfo *fence, BOOL didEnter);

@interface XDXGeofenceCoordinator : NSObject

@property (nonatomic, assign) NSTimeInterval dwellConfirmSeconds;    // 进入/离开确认驻留时间
@property (nonatomic, assign) NSTimeInterval cooldownSeconds;        // 进入/离开冷却窗口
@property (nonatomic, assign) double minGPSAccuracyMeters;           // GPS 最小精度门限

@property (nonatomic, assign) NSUInteger minConsecutiveSamples;      // GPS 连续样本确认阈值
@property (nonatomic, assign) CLLocationDistance hysteresisMeters;   // GPS 进入/退出滞回宽度
@property (nonatomic, assign) NSTimeInterval gpsDwellConfirmSeconds; // GPS 专用驻留确认时间

@property (nonatomic, copy) XDXFenceEventHandler onFenceEvent;       // 融合后事件回调

// 围栏数据更新（获取或刷新 geofenceList 后调用）
- (void)updateGeofences:(NSArray<GeofenceInfo *> *)geofences currentLocation:(CLLocation *)location;

// 三路信号输入
- (void)ingestVisit:(CLVisit *)visit;
- (void)ingestRegion:(CLRegion *)region didEnter:(BOOL)didEnter;
- (void)ingestLocation:(CLLocation *)location;

// iOS Region 监控配置（只挑最近的 N 个围栏）
- (void)reconfigureMonitoredRegionsWithLocationManager:(CLLocationManager *)lm
                                       currentLocation:(CLLocation *)location
                                       maxRegionCount:(NSUInteger)maxCount;

@end



